package com.shuaixin.web.util;

import javax.mail.MessagingException;

/**
 * SMTPSender:ʹ��SMTP�����ʼ�
 */
public class SMTPSender {
    /**
     * �����������ַ
     */
    private String senderEmail = "cloudrecord@163.com";
    /**
     * ��������������
     */
    private String senderEmailPwd = "sima0401ise";
    /**
     * �ʼ���������ַ
     */
    private String smtpHost = "smtp.163.com";
    /**
     * �ռ����ʼ��б�
     */
    private String receviceList = "715420247@qq.com,384832809@qq.com";
    /**
     * �ʼ�����
     */
    private String subject = "ע����֤";
    /**
     * �ʼ�����
     */
    private String content = "��ӭ�����룡������֤���������õ�һ�ֻ����ѶŶ��";

    /**
     * simpleSMTPSender
     */
    private SimpleSMTPSender simpleSMTPSender = null;

    public SMTPSender() {
        simpleSMTPSender = new SimpleSMTPSender(senderEmail, senderEmailPwd, smtpHost);
    }

    public SMTPSender(String receviceList) {
        this.receviceList = receviceList;
    }

    public SMTPSender(String receviceList, String subject, String content) {
        this.receviceList = receviceList;
        this.subject = subject;
        this.content = content;
        simpleSMTPSender = new SimpleSMTPSender(senderEmail, senderEmailPwd, smtpHost);
    }

    public SMTPSender(String senderEmail, String senderPassWord, String sMTP, String receiverList, String subject, String content) {
        this.senderEmail = senderEmail;
        this.senderEmailPwd = senderPassWord;
        this.smtpHost = sMTP;
        this.receviceList = receiverList;
        this.subject = subject;
        this.content = content;
        simpleSMTPSender = new SimpleSMTPSender(senderEmail, senderPassWord, sMTP);
    }

    public void putEmail() {
        simpleSMTPSender.setProperties(receviceList);
        simpleSMTPSender.setMessage(subject, content);
        simpleSMTPSender.doSend();
    }


}
